( function($) { 
    $(document).ready(function(){
        //traitement de l'envoi d'une enchère
        $('.sent_elt').unbind().click(function(){
            var idelt = this.id;
            idelt = idelt.split('-');
            iduser =idelt.pop();
            if(iduser==0){
                return false;
            }else{
                idpro =idelt.pop();
                $.ajax({
                    type: "POST", 
                    url: "./encheres-terminee.html",
                    data: "email="+iduser+"&idprod="+idpro,
                    cache: false,
                    success:  function(response){
                        //$('#center-column').html(response);
                        $('#send_enchere'+idpro).attr('checked','checked');
                        $('.infos').html('<img alt="ok" src="../backend_images/ok2.png" />Enchère envoyée  au gagnant!')
                        $('.infos').show();
                        $.scrollTo( $('.infos'), 1000 );
                        setTimeout("$('.infos').hide('fast')",3000);
                        
                    },

                    onFailure: function(xhr){
                        alert("Erreur lors du placement de l'ench&egrave;re");
                    },
                })
            }
            return false;
        });
    });
} ) ( jQuery )


